package study07;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class MyClient {
			public static void main(String[] args) {
				   try {
					   Socket client = new Socket("127.0.0.1", 10000);
					   PrintWriter printWriter = new PrintWriter(client.getOutputStream());
				                  
				              
						printWriter.println("你好今天吃了吗");
						
						printWriter.flush();
						InputStreamReader streamReader = new InputStreamReader(client.getInputStream());
						
						
						BufferedReader reader = new BufferedReader(streamReader);
						String advice =reader.readLine();
						
						
						System.out.println("来自于服务端"+advice);
						reader.close();
				} catch (UnknownHostException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
}
